Skip to content

Export interface for external call#2131

Open
TaranDahl wants to merge 5 commits intoPhobos-developers:developfrom
TaranDahl:Interop
Open

Export interface for external call#2131
TaranDahl wants to merge 5 commits intoPhobos-developers:developfrom
TaranDahl:Interop

Conversation

@TaranDahl
Copy link
Contributor

Interoperability

Phobos has opened the external interfaces of some key components. If you are also developing your own engine extension and wish to use Phobos at the same time, please check out Interop.

@TaranDahl TaranDahl requested a review from Copilot March 10, 2026 15:53
@TaranDahl TaranDahl added Interaction Something related to interaction with other extension, program etc. Needs testing ⚙️T3 labels Mar 10, 2026
@TaranDahl TaranDahl added the No Documentation Needed No documentation needed whatsoever label Mar 10, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a small C ABI “Interop” surface to Phobos so other engine extensions can call into selected Phobos systems at runtime (DLL exports), along with documentation/changelog entries announcing the feature.

Changes:

  • Introduces exported interop functions for TechnoExt::ConvertToType and AttachEffect attach/detach/transfer operations.
  • Wires the new interop sources into the MSBuild project.
  • Documents the new interoperability entry in README, Whats-New, and CREDITS.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Interop/TechnoExt.h Declares exported ConvertToType_Phobos C ABI function.
src/Interop/TechnoExt.cpp Implements the exported type-conversion wrapper.
src/Interop/AttachEffect.h Declares exported C ABI functions for AttachEffect operations.
src/Interop/AttachEffect.cpp Implements exported wrappers for attaching/detaching/transferring effects.
docs/Whats-New.md Adds a changelog entry referencing the new interop feature.
README.md Adds an “Interoperability” section pointing to src/Interop.
Phobos.vcxproj Adds the new interop .cpp/.h files to the build.
CREDITS.md Adds credit entry for the interop export feature.

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Metadorius
Copy link
Member

I am not sure why all pointers are void*?

@ZivDero
Copy link
Contributor

ZivDero commented Mar 10, 2026

I am not sure why all pointers are void*?

My bet would be that to make it so that this does not depend on YRpp (in case someone is using their own implementation of YRpp, perhaps)

@TaranDahl
Copy link
Contributor Author

I am not sure why all pointers are void*?

Copilot said that if I use TechnoClass*, it will break the P/Invoke compatibility. When calling in C#, I can't directly use IntPtr. I have to do type mapping, otherwise the call will fail.

@Metadorius
Copy link
Member

Copilot said that if I use TechnoClass*, it will break the P/Invoke compatibility. When calling in C#, I can't directly use IntPtr. I have to do type mapping, otherwise the call will fail.

This sounds like AI hallucinations...

  1. You can have unsafe methods in which you can do whatever like pointers etc
  2. C# marshaller isn't as rigid as that usually

@TaranDahl
Copy link
Contributor Author

Copilot said that if I use TechnoClass*, it will break the P/Invoke compatibility. When calling in C#, I can't directly use IntPtr. I have to do type mapping, otherwise the call will fail.

This sounds like AI hallucinations...

  1. You can have unsafe methods in which you can do whatever like pointers etc
  2. C# marshaller isn't as rigid as that usually

Changed

TaranDahl and others added 2 commits March 11, 2026 15:16
Co-authored-by: Noble Fish <89088785+DeathFishAtEase@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@phoboscn-bot
Copy link

To Chinese users:
This pull request has been mentioned on Phobos CN. There might be relevant details there:

致中文用户:
此拉取请求已在 Phobos CN 上被提及。那里可能有相关详细信息:

https://www.phoboscn.top/t/topic/229/1

@secsome
Copy link
Member

secsome commented Mar 13, 2026

Macros like PHOBOS_EXPORT and PHOBOS_DECL can make the code cleaner and such macros are widely used in most projects.
Just an example:

#define PHOBOS_DECL __stdcall
#define PHOBOS_EXPORT extern "C" __declspec(dllexport) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Interaction Something related to interaction with other extension, program etc. No Documentation Needed No documentation needed whatsoever ⚙️T3 Tested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants